import logging
from PyQt5 import QtCore
MEDIA_ROOT="./media"
config=None
def timestr():
    db = QtCore.QDateTime.currentDateTime()
    db_str = db.toString("yyyy_MM_dd_hh_mm_ss")
    return db_str
def in_list(one, l1):
    for i in range(len(l1)):
        # logging.info(str(one)+str(l1[i]))
        if one in l1[i]:
            return i
    return -1
def myfloat(f):
    try:
        r = float(f)
    except ValueError:
        r = 0
    except TypeError:
        r=0
    return r
def is_float(a_string):
    try:
        float(a_string)
        return True
    except TypeError:
        return False
    except ValueError:
        return False    
def isfloat(f):
    try:
        r = float(f)
        return True
    except ValueError:
        return False
def inItems(items, one):
    for s in items:
        if s[0] == one[0] and s[1] == one[1]:
            return True
    return False    
def isDev():
    try:
        from getmac import get_mac_address
        mac=get_mac_address()
        print(mac)
        if mac in ['00:e1:8c:ea:99:5d']:
            return True
        else:
            return False    
    except ModuleNotFoundError:
        return False